package com.kinyx.examples.enums.impl;

import com.kinyx.framework.enums.impl.ErrorCodeX;
import com.kinyx.framework.exception.KRuntimeException;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum Gender {

	MALE('M'), FEMALE('F');

	private final char code;

	public static Gender fromCode(final char code) {
		switch (code) {
			case 'M':
				return MALE;
			case 'F':
				return FEMALE;
			default :
				throw new KRuntimeException(ErrorCodeX.NotImplemented);
		}
	}

}
